* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Helvetica Neue', Arial, sans-serif;
}

:root {
    --lens-size: 1800px; /* Adjusted to fit 1920x1080 resolution */
    --bg-font-size: 50px;
    --mag-font-size: clamp(60px, 10.5vw, 200px); /* Optical scaling: min 60px, target 10.5vw, max 200px */
    --lens-vertical-offset: -40px; /* Adjusts vertical position of the glasses relative to text */
    --gyro-x: 0px;
    --gyro-y: 0px;
}

body {
    background-color: #f2efe9; /* The sand/champagne color from the video */
    overflow: hidden;
}

nav {
    display: flex;
    justify-content: space-between;
    padding: 30px 50px;
    position: fixed;
    width: 100%;
    z-index: 100;
}

.logo {
    font-weight: 800;
    letter-spacing: 2px;
}

.menu a {
    text-decoration: none;
    color: black;
    margin-left: 30px;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.hero {
    height: 100vh;
    width: 100vw;
    min-width: 100vw; /* Ensures the section doesn't shrink in flex container */
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* SLIDER CONTAINER */
.slider-container {
    display: flex;
    width: 100%;
    height: 100vh;
    transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1); /* Smooth easing for page transitions */
}

/* MARQUEE EFFECT */
.marquee-container {
    position: absolute;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    z-index: 1;
    top: 50%;
    transform: translateY(calc(-50% + var(--lens-vertical-offset)));

    /* Create a mask that shows text ONLY OUTSIDE the lens shape */
    --mask-image: url('glass lenses cut out.png');
    -webkit-mask-image: var(--mask-image);
    mask-image: var(--mask-image);
    -webkit-mask-size: 100vw calc(100vw * 0.5625); /* 16:9 Aspect Ratio (1080/1920) */
    mask-size: 100vw calc(100vw * 0.5625);
    -webkit-mask-position: calc(50% + var(--gyro-x)) calc(50% + var(--gyro-y));
    mask-position: calc(50% + var(--gyro-x)) calc(50% + var(--gyro-y));
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    
    /* 'source-out' shows source (text) only where it does NOT overlap with mask */
    -webkit-mask-composite: source-out;
    mask-composite: source-out;
}

.marquee-content {
    display: inline-block;
    font-size: var(--bg-font-size);
    font-weight: 900;
    color: #c7c7c7;
    animation: scroll 50s linear infinite;
    margin-top: calc(var(--lens-vertical-offset) * -1); /* Counter-offset to keep text centered on screen */
    will-change: transform;
    backface-visibility: hidden;
}

@keyframes scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* CAMERA OVERLAY */
.image-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(calc(-50% + var(--gyro-x)), calc(-50% + var(--lens-vertical-offset) + var(--gyro-y)));
    z-index: 2; /* Sits above the text */
    width: 100vw; /* Synced with mask size */
    max-width: none;
    aspect-ratio: 1920 / 1080;
    pointer-events: none; /* Allows clicking through image to buttons if needed */
}

.image-overlay img {
    width: 100%;
    height: auto;
    /* Removed max-height to prevent squashing the image aspect ratio */
    display: block;
    filter: drop-shadow(0 20px 50px rgba(0,0,0,0.2));
}

.image-overlay .frame-layer {
    position: relative;
    z-index: 2;
}

.image-overlay .lenses-layer {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

/* GLASS DISTORTION */
.glass-distortion {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    transform: translate(var(--gyro-x), calc(var(--lens-vertical-offset) + var(--gyro-y)));
}

.glass-distortion::before,
.glass-distortion::after {
    content: '';
    position: absolute;
    top: 20%;
    width: 40%;
    height: 60%;
    border-radius: 50%;
    backdrop-filter: blur(4px) contrast(1.1) brightness(1.2);
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.05) 30%, transparent 70%);
    box-shadow: inset 10px 10px 30px rgba(255, 255, 255, 0.2), 
                inset -5px -5px 15px rgba(0, 0, 0, 0.1);
}

.glass-distortion::before { left: 5%; }
.glass-distortion::after { right: 5%; }

/* LENS MAGNIFICATION LAYER */
.lens-mask-container {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3; /* Ensure text sits on top of the glass layer */
    pointer-events: none;
    transform: translateY(calc(-50% + var(--lens-vertical-offset)));

    /* Mask shows text only INSIDE lens shape */
    --mask-image: url('glass lenses.png');
    -webkit-mask-image: var(--mask-image);
    mask-image: var(--mask-image);
    -webkit-mask-size: 100vw calc(100vw * 0.5625); /* 16:9 Aspect Ratio */
    mask-size: 100vw calc(100vw * 0.5625);
    -webkit-mask-position: calc(50% + var(--gyro-x)) calc(50% + var(--gyro-y));
    mask-position: calc(50% + var(--gyro-x)) calc(50% + var(--gyro-y));
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    
    /* 'source-in' keeps only where source and mask overlap */
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
    
    /* Add subtle inner shadow for lens depth */
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05);
}

.magnified-layer {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.magnified-text {
    font-size: var(--mag-font-size);
    font-weight: 900;
    color: #000000;
    white-space: nowrap;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-smooth: always;
    
    /* Text shadow for additional sharpness and depth */
    text-shadow: 
        0 0 1px rgba(0, 0, 0, 0.1),
        0 1px 2px rgba(0, 0, 0, 0.1);
    
    /* Increased contrast */
    filter: contrast(1.1);
    
    animation: scroll 50s linear infinite; /* Phase-locked with background */
    margin-top: calc(var(--lens-vertical-offset) * -1); /* Counter-offset */
    will-change: transform;
    backface-visibility: hidden;
}

/* CTA BUTTONS */
.cta-buttons {
    position: absolute;
    bottom: 15%;
    z-index: 100;
    display: flex;
    gap: 15px;
}

button {
    padding: 12px 30px;
    border-radius: 50px;
    border: 1px solid black;
    cursor: pointer;
    font-size: 0.8rem;
    transition: 0.3s;
}

.btn-primary { background: black; color: white; }
.btn-secondary { background: transparent; color: black; }

button:hover {
    transform: scale(1.05);
    opacity: 0.8;
}

/* RESPONSIVE ADJUSTMENTS */
@media (max-width: 1280px) { /* Increased breakpoint to handle laptops/tablets gracefully */
    .image-overlay {
        width: 100vw;
    }

    .marquee-container {
        -webkit-mask-size: 100vw calc(100vw * 0.5625);
        mask-size: 100vw calc(100vw * 0.5625);
    }

    .lens-mask-container {
        -webkit-mask-size: 100vw calc(100vw * 0.5625);
        mask-size: 100vw calc(100vw * 0.5625);
    }
}

/* NAVIGATION ARROWS */
.nav-arrows-wrapper {
    position: fixed;
    bottom: 30px;
    left: 0;
    width: 100%;
    height: calc(15% - 30px); /* Fills the space between dots (30px) and CTA buttons (15%) */
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 80px;
    z-index: 150;
    pointer-events: none; /* Allows clicks to pass through the container */
}

.nav-arrow {
    position: relative;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    pointer-events: auto; /* Re-enables clicks on the buttons */
}

.nav-arrow:hover {
    background: #fff;
    transform: scale(1.1);
}

@media (max-width: 768px) {
    /* Disable heavy blur effects on mobile for performance */
    .glass-distortion::before,
    .glass-distortion::after {
        backdrop-filter: none;
        background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0.1) 30%, transparent 70%);
    }

    :root {
        /* Center the lens vertically on mobile for accurate text alignment */
        --lens-vertical-offset: 0px;
    }

    /* Optimize Layout for Mobile */
    .cta-buttons {
        bottom: 25%; /* Move buttons up to create vertical space */
        width: 100%;
        left: 0;
        justify-content: center;
    }

    .nav-arrows-wrapper {
        gap: 40px; /* Bring arrows closer together */
        height: calc(25% - 30px); /* Adjust height to fill the new gap */
    }

    .nav-arrow {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
}

/* PAGINATION DOTS */
.pagination-dots {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 102;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
}

.dot.active {
    background-color: #000;
    transform: scale(1.2);
}

.dot:hover {
    background-color: rgba(0, 0, 0, 0.5);
}

/* PAGE SPECIFIC MASK OVERRIDES */
#page-2 .marquee-container {
    --mask-image: url('glass-lenses_0002_glass-lenses-cut-out.png');
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
}
#page-2 .lens-mask-container {
    --mask-image: url('glass-lenses_0000_glass-lenses.png');
    -webkit-mask-composite: source-out;
    mask-composite: exclude;
}

#page-3 .marquee-container {
    --mask-image: url('glass-lenses-cut-out_3.png');
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
}
#page-3 .lens-mask-container {
    --mask-image: url('glass lenses_3.png');
    -webkit-mask-composite: source-out;
    mask-composite: exclude;
}

#page-4 .marquee-container {
    --mask-image: url('glass-lenses-cut-out_4.png');
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
}
#page-4 .lens-mask-container {
    --mask-image: url('glass lenses_4.png');
    -webkit-mask-composite: source-out;
    mask-composite: exclude;
}

#page-5 .marquee-container {
    --mask-image: url('glass-lenses-cut-out_5.png');
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
}
#page-5 .lens-mask-container {
    --mask-image: url('glass lenses_5.png');
    -webkit-mask-composite: source-out;
    mask-composite: exclude;
}